﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.MapNotificationTypes.PartyLeaderChangeNotification
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System.Collections.Generic;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.Core;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.MapNotificationTypes
{
  public class PartyLeaderChangeNotification : InformationData
  {
    internal static void AutoGeneratedStaticCollectObjectsPartyLeaderChangeNotification(
      object o,
      List<object> collectedObjects)
    {
      ((InformationData) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      base.AutoGeneratedInstanceCollectObjects(collectedObjects);
      collectedObjects.Add((object) this.Party);
    }

    internal static object AutoGeneratedGetMemberValueParty(object o)
    {
      return (object) ((PartyLeaderChangeNotification) o).Party;
    }

    public override TextObject TitleText => new TextObject("{=nFl0ufe3}A party without a leader");

    public override string SoundEventPath => "event:/ui/notification/death";

    [SaveableProperty(1)]
    public MobileParty Party { get; private set; }

    public PartyLeaderChangeNotification(MobileParty party, TextObject descriptionText)
      : base(descriptionText)
    {
      this.Party = party;
    }

    public override bool IsValid()
    {
      MobileParty party = this.Party;
      return party != null && party.IsActive;
    }
  }
}
